package com.yuanchu.marketing.controller;

import com.yuanchu.common.utils.PageResult;
import com.yuanchu.common.utils.R;
import com.yuanchu.marketing.entity.YoshopUserPointsLogEntity;
import com.yuanchu.marketing.service.YoshopUserPointsLogService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-02-19 9:03
 */
@RestController
@RequestMapping("points")
public class PointsLogController {

    @Resource
    private YoshopUserPointsLogService userPointsLogService;

    @GetMapping("/log")
    public R queryUserPointsLogList(@RequestParam Integer page,
                                    @RequestParam(value = "search", required = false) String search,
                                    @RequestParam(value = "betweenTimeStart", required = false) String betweenTimeStart,
                                    @RequestParam(value = "betweenTimeEnd", required = false) String betweenTimeEnd
        ) {
        PageResult<YoshopUserPointsLogEntity> userPointsLog = userPointsLogService.queryUserPointsLog(page, search, betweenTimeStart,betweenTimeEnd );
        Map<String, Object> map = new HashMap<>();
        map.put("list", userPointsLog);
        return R.ok().put("data", map);
    }




}
